﻿using FamilyTreeProject.Collections;
using System.Collections.Generic;

namespace FamilyTreeProject
{
    /// <summary>
    /// An interface that represents the Individuals Service
    /// </summary>
    public interface IIndividualsService
    {
        /// <summary>
        /// Adds an individual to the data store and sets the <see cref="Individual.Id"/> property
        /// of <paramref name="newIndividual"/> to the id of the new individual.
        /// </summary>
        /// <param name="newIndividual">The individual to add to the data store.</param>
        void AddIndividual(Individual newIndividual);

        /// <summary>
        /// Deletes an individual from the data store
        /// </summary>
        /// <remarks>
        /// The delete operation takes effect immediately
        /// </remarks>
        /// <param name="individual">The individual to delete</param>
        void DeleteIndividual(Individual individual);

        /// <summary>
        /// Retrieves all the children of an Individual
        /// </summary>
        /// <param name="parentId">The Id of the Parent</param>
        /// <returns>An <see cref="IList{Individual}"/>.</returns>
        IList<Individual> GetChildren(int parentId);

        /// <summary>
        /// Retrieves all the children of a Couple
        /// </summary>
        /// <param name="fatherId">The Id of the Father</param>
        /// <param name="motherId">The Id of the Mother</param>
        /// <returns>An <see cref="IList{Individual}"/>.</returns>
        IList<Individual> GetChildren(int fatherId, int motherId);

        /// <summary>
        /// Retrieves a single Individual
        /// </summary>
        /// <param name="id">The Id of the Indiidual to retrieve</param>
        /// <param name="includeChildren">A flag that indicates whether to get the children of the Individual</param>
        /// <returns>An <see cref="Individual"/></returns>
        Individual GetIndividual(int id, bool includeChildren);

        /// <summary>
        /// Retrieves all the Individuals in a Tree
        /// </summary>
        /// <param name="treeId">The Id of the Tree</param>
        /// <returns>An <see cref="IList{Individual}"/> of <see cref="Individual"/> objects.</returns>
        IList<Individual> GetIndividuals(int treeId);

        /// <summary>
        /// Retrieves a single page of Individuals in a Tree
        /// </summary>
        /// <param name="treeId">The Id of the Tree</param>
        /// <param name="pageNumber">The page number (0-indexed)</param>
        /// <param name="pageSize">The size of the page</param>
        /// <returns>A <see cref="IPagedList{T}"/> of  <see cref="Individual"/> objects.</returns>
        IPagedList<Individual> GetIndividuals(int treeId, int pageNumber, int pageSize);

        /// <summary>
        /// Updates an individual in the data store.
        /// </summary>
        /// <param name="individual">The individual to update in the data store.</param>
        void UpdateIndividual(Individual individual);
    }
}
